package com.young.common.client.log.handler;

import com.young.interfaces.log.model.LogDTO;
import com.young.interfaces.log.service.ILogHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 基础日志处理器
 * Created by rookie on 2017/11/10.
 */
public class BasicLogHandler implements ILogHandler {

    private static final Logger logger = LoggerFactory.getLogger(BasicLogHandler.class);

    @Override
    public void handleBefore(LogDTO logDTO) {

    }

    @Override
    public void handle(LogDTO logDTO) {
        logger.info("[{}] -TraceId={} -请求方式{} -请求时间{} -类{} -方法{} -响应时间{}ms -来源IP:{}",
                logDTO.getLogContent(), logDTO.getTraceId(), logDTO.getMethod(), logDTO.getBeginTime(), logDTO.getClassName(), logDTO.getMethodName(), logDTO.getMs(), logDTO.getClientIp());
    }

    @Override
    public void handleAfter(LogDTO logDTO) {

    }
}
